﻿using System;
using System.Linq.Expressions;

namespace Fuse8.DomainFramework.DataAccess.ExpressionSlicers
{
    /// <summary>
    /// Provides contract for expression slicing
    /// </summary>
    public interface ISlicerService
    {
        /// <summary>
        /// Adds expression for specified and inherited types
        /// </summary>
        /// <param name="slicer"></param>
        /// <typeparam name="T"></typeparam>
        void Add<T>(Expression<Func<T, bool>> slicer);

        /// <summary>
        /// Adds not function to get expression for specified and inherited types
        /// </summary>
        /// <param name="asyncSlicer"></param>
        /// <typeparam name="T"></typeparam>
        void AddDynamic<T>(Func<Expression<Func<T, bool>>> asyncSlicer);

        /// <summary>
        /// Get resulting expression
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        LambdaExpression ResolveForType(Type type);
    }
}